//
//  XQPositionDetailFirstTableViewCell.swift
//  XiaoQiQiaoSwift
//
//  Created by tech-lab on 2016/11/30.
//  Copyright © 2016年 校企桥. All rights reserved.
//

import UIKit

class XQPositionDetailFirstTableViewCell: UITableViewCell {

    var titleLabel = UILabel()
    var cityLabel = UILabel()
    var workxpLabel = UILabel()
    var degreexpLabel = UILabel()
    var typeLabel = UILabel()
    var salaryLabel = UILabel()
    

    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        InitUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    var detailMode : XQPositionDetailPDMode?{
        didSet{
            titleLabel.text = detailMode?.position_name
            cityLabel.text = detailMode?.area
            workxpLabel.text = detailMode?.experience
            degreexpLabel.text = detailMode?.education
            typeLabel.text = detailMode?.position_type
            salaryLabel.text = detailMode?.salary
            
        }
    }
    
    func InitUI() {
        titleLabel = UILabel.init(frame: CGRect.zero)
        self.contentView .addSubview(titleLabel)
        
        cityLabel = UILabel.init(frame: CGRect.zero)
        cityLabel.font = UIFont.systemFont(ofSize: 14)
        self.contentView.addSubview(cityLabel)

        workxpLabel = UILabel.init(frame: CGRect.zero)
        workxpLabel.font = UIFont.systemFont(ofSize: 14)
        self.contentView.addSubview(workxpLabel)

        degreexpLabel = UILabel.init(frame: CGRect.zero)
        degreexpLabel.font = UIFont.systemFont(ofSize: 14)
        self.contentView.addSubview(degreexpLabel)

        typeLabel = UILabel.init(frame: CGRect.zero)
        typeLabel.font = UIFont.systemFont(ofSize: 12)
        self.contentView .addSubview(typeLabel)
        
        salaryLabel = UILabel.init(frame: CGRect.zero)
        salaryLabel.textColor = UIColor.orange
        salaryLabel.font = UIFont.systemFont(ofSize: 14)
        self.contentView.addSubview(salaryLabel)
        
        titleLabel.snp.makeConstraints { (make) in
            make.left.equalTo(self.contentView.snp.left).offset(10)
            make.top.equalTo(self.contentView.snp.top).offset(10)
        }
        
        salaryLabel.snp.makeConstraints { (make) in
            make.right.equalTo(self.contentView.snp.right).offset(-10)
            make.top.equalTo(self.contentView.snp.top).offset(10)
        }
        
        let image1 = UIImageView.init(frame: CGRect.zero)
        self.contentView.addSubview(image1)

        image1.snp.makeConstraints { (make) in
            make.left.equalTo(self.contentView.snp.left).offset(10)
            make.bottom.equalTo(self.contentView.snp.bottom).offset(-5)
            make.width.equalTo(15)
            make.height.equalTo(15)
        }
        
        cityLabel.snp.makeConstraints { (make) in
            make.left.equalTo(image1.snp.right).offset(5)
            make.bottom.equalTo(self.contentView.snp.bottom).offset(-5)
        }
        
        let image2 = UIImageView.init(frame: CGRect.zero)
        self.contentView.addSubview(image2)

        image2.snp.makeConstraints { (make) in
            make.left.equalTo(cityLabel.snp.right).offset(10)
            make.bottom.equalTo(self.contentView.snp.bottom).offset(-5)
            make.width.equalTo(15)
            make.height.equalTo(15)
        }

        workxpLabel.snp.makeConstraints { (make) in
            make.left.equalTo(image2.snp.right).offset(5)
            make.bottom.equalTo(self.contentView.snp.bottom).offset(-5)
        }

        let image3 = UIImageView.init(frame: CGRect.zero)
        self.contentView.addSubview(image3)

        image3.snp.makeConstraints { (make) in
            make.left.equalTo(workxpLabel.snp.right).offset(10)
            make.bottom.equalTo(self.contentView.snp.bottom).offset(-5)
            make.width.equalTo(15)
            make.height.equalTo(15)
        }

        degreexpLabel.snp.makeConstraints { (make) in
            make.left.equalTo(image3.snp.right).offset(5)
            make.bottom.equalTo(self.contentView.snp.bottom).offset(-5)
        }

        
        let image4 = UIImageView.init(frame: CGRect.zero)
        self.contentView.addSubview(image4)

        image4.snp.makeConstraints { (make) in
            make.left.equalTo(degreexpLabel.snp.right).offset(10)
            make.bottom.equalTo(self.contentView.snp.bottom).offset(-5)
            make.width.equalTo(15)
            make.height.equalTo(15)
        }

        typeLabel.snp.makeConstraints { (make) in
            make.left.equalTo(image4.snp.right).offset(5)
            make.bottom.equalTo(self.contentView.snp.bottom).offset(-5)
        }
        
        image1.image = UIImage.init(named: "difang")
        image2.image = UIImage.init(named: "jingyan")
        image3.image = UIImage.init(named: "xueli")
        image4.image = UIImage.init(named: "quanzhi")


        
        
    }
    
    
}

